/* 
 * File:   SpriteManager.h
 * Copyright (C) 2009
 *		Sergio Padrino Recio (PadrinatoR)
 *
 * Created on 13 de diciembre de 2009, 17:46
 *
 * This file is part of BombProject.
 *
 * BombProject is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * BombProject is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with BombProject.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _SPRITEMANAGER_H
#define	_SPRITEMANAGER_H

#include <vector>
#include <string>
#include "AnimatedSprite.h"
#include "Sprite.h"
#include "ResourceManager.h"
#include "Player.h"

using namespace std;

/**
 * Manages all the sprites.
 * @see Sprite, AnimatedSprite
 */
class SpriteManager {
public:
    ~SpriteManager();

    static SpriteManager* getInstance();
    static void deleteInstance();

    Player* createPlayer(string character);
    void deletePlayer(Player* player) { removeForegroundSprite(player); }

    void addForegroundSprite(Sprite* sprite);
    void removeForegroundSprite(Sprite* sprite);

    void addBackgroundSprite(Sprite* sprite);
    void removeBackgroundSprite(Sprite* sprite);

    void drawAll(SDL_Surface* surface);
    
private:
    SpriteManager();

    void sortForegroundSprites();

private:
    static SpriteManager* mInstance;

    ResourceManager* mResourceManager;
    vector<Sprite*> mBackgroundSprites;
    vector<Sprite*> mForegroundSprites;
};

#endif	/* _SPRITEMANAGER_H */

